package cz.proks.bank.client;

import java.math.BigDecimal;
import java.util.List;

import javax.xml.ws.WebServiceException;

import org.springframework.stereotype.Service;

import cz.proks.bank.service.exchangeratesservice.ExchangeRatesService;
import cz.proks.bank.service.exchangeratesservice.ExchangeRatesService_Service;
import cz.proks.bank.service.exchangeratesservice.UnsupportedCurrencyFaultException;

@Service
public class ExchangeRatesServiceClient implements ExchangeRatesService {
	private ExchangeRatesService service;
	
	public ExchangeRatesServiceClient() throws WebServiceException {
		service = new ExchangeRatesService_Service().getExchangeRatesServicePort();
	}

	@Override
	public BigDecimal getExchangeRate(String fromCurrency, String toCurrency)
			throws UnsupportedCurrencyFaultException {
		return service.getExchangeRate(fromCurrency, toCurrency);
	}

	@Override
	public List<String> getSupportedCurrencies() {
		return service.getSupportedCurrencies();
	}	
}
